import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '@/views/home/index.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      redirect: '/home'
    },
    {
      path: '/home',
      name: 'Home',
      component: HomeView,
      meta:{
        title:'首页'
      }
    },
    {
      path: '/wxlogin',
      component: () => import('../views/wxlogin/index.vue'),
    },
    {
      path: '/hospitalDetail',
      name: 'HospitalDetail',
      component: () => import('../views/hospitalDetail/index.vue'),
      children: [
        {
          path: 'register',
          name: 'Register',
          component: () => import('../views/hospitalDetail/register/index.vue')
        },
        {
          path: 'register_step1',
          name: 'RegisterStep1',
          component: () => import('../views/hospitalDetail/register/register_step1.vue')
        },
        {
          path: 'detail',
          name: 'Detail',
          component: () => import('../views/hospitalDetail/detail/index.vue')
        },
        {
          path: 'notice',
          name: 'Notice',
          component: () => import('../views/hospitalDetail/notice/index.vue')
        },
        {
          path: 'close',
          name: 'Close',
          component: () => import('../views/hospitalDetail/close/index.vue')
        },
        {
          path: 'search',
          name: 'Search',
          component: () => import('../views/hospitalDetail/search/index.vue')
        }
      ],
      meta: {
        title: '医院详情'
      }
    }
  ],
  scrollBehavior() {
    return {
      left: 0,
      top: 0
    }
  }
})

export default router
